<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="UTF-8">
    <title>用户列表</title>

    <link rel="stylesheet" th:href="@{/layui/css/layui.css}">
    <link rel="stylesheet" th:href="@{lib/css/main.css}">
    <link rel="stylesheet" th:href="@{/lib/css/public.css}">

    <script th:src="@{/lib/js/jquery-3.4.1.min.js}"></script>
    <!--<script th:src="@{/layui/layui.js}"></script>-->
    <!--<script th:src="@{/lib/js/allclass.js}"></script>-->



</head>




<body>

<div class="table">
    <h2 class="tablename">饲养师信息</h2>
    <hr class="layui-bg-gray">
    <table class="layui-hide" id="demo" lay-filter="test"></table>

    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body ">

                            <!--<div class="layui-inline layui-show-xs-block">-->
                                <!--<input class="layui-input"  autocomplete="off" placeholder="开始日" name="start" id="start">-->
                            <!--</div>-->
                            <!--<div class="layui-inline layui-show-xs-block">-->
                                <!--<input class="layui-input"  autocomplete="off" placeholder="截止日" name="end" id="end">-->
                            <!--</div>-->
                            <div class="layui-inline layui-show-xs-block">
                                <input type="text" name="username"  id="studentname" th:value="${name}" placeholder="请输入饲养师姓名" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-inline layui-show-xs-block">
                                <button class="layui-btn" onclick="index()" lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
                            </div>

                    </div>
                    <!--<div class="layui-card-header">-->
                        <!--<button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量删除</button>-->
                        <!--<button class="layui-btn" onclick="xadmin.open('添加用户','./admin-add.html',600,400)"><i class="layui-icon"></i>添加</button>-->
                    <!--</div>-->
                    <div class="layui-card-body ">
                        <table class="layui-table layui-form">
                            <thead>
                            <tr>

                                <th>姓名</th>
                                <th>性别</th>
                                <th>手机</th>
                                <th>擅长</th>
                                <th>价格</th>
                                <th>操作</th>
                            </thead>
                            <tbody>
                            <div th:each="j:${list.list}">
                            <tr>

                                <td th:text="${j.name}">1</td>
                                <td th:text="${j.sex}">admin</td>
                                <td th:text="${j.phone}">18925139194</td>
                                <td th:text="${j.shanchang}">113664000@qq.com</td>
                                <td th:text="${j.price}+'元/天'">超级管理员</td>
                                <!--<td class="td-status">-->
                                    <!--<span class="layui-btn layui-btn-normal layui-btn-mini">已启用</span></td>-->
                                <td class="td-manage">
                                  <!--从  <input type="date" class="begintime" th:id="${j.id}+begin"/>开始寄养，-->
                                    <!--到<input type="date" class="endtime" th:id="${j.id}+end"/>结束饲养-->
                                   <button type="button" th:onclick="|javascript:siyang('${j.id}')|" class="layui-btn layui-btn-normal layui-btn-radius">选择寄养</button>
                                    <!--<a onclick="member_stop(this,'10001')" href="javascript:;"  title="启用">-->
                                        <!--<i class="layui-icon">&#xe601;</i>-->
                                    <!--</a>-->
                                    <!--<a title="编辑"  onclick="xadmin.open('编辑','admin-edit.html')" href="javascript:;">-->
                                        <!--<i class="layui-icon">&#xe642;</i>-->
                                    <!--</a>-->
                                    <!--<a title="删除" onclick="member_del(this,'要删除的id')" href="javascript:;">-->
                                        <!--<i class="layui-icon">&#xe640;</i>-->
                                    <!--</a>-->
                                </td>
                            </tr>
                            </div>
                            </tbody>
                        </table>
                    </div>
                    <div class="layui-card-body ">
                        <div class="page">
                            <div>
                                当前页: [[${list.pageNum}]] 总页数：[[${list.pages}]] 总条数：[[${list.total}]] <a class="layui-btn layui-btn-normal layui-btn-radius" href="#" onclick="index()">首页</a>    <a href="#" class="layui-btn layui-btn-normal layui-btn-radius" onclick="shangyiye()">上一页</a> <a class="layui-btn layui-btn-normal layui-btn-radius" id="pagenext"  href="#" onclick="xiayiye()" >下一页</a> <a class="layui-btn layui-btn-normal layui-btn-radius" href="#" onclick="wenye()">尾页</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>

    //首页
    function index(){
        //name
        var  name =  $("#studentname").val()
        //首页
        var pageNum= 1;
        location.href="/saisinglist?pageNum="+pageNum+"&name="+name;
    }

    //上一页
    function shangyiye(){
        var  name =  $("#studentname").val()
        //上一页
        var  shangy =  [[${list.prePage}]]

        location.href="/saisinglist?pageNum="+shangy+"&name="+name;
    }

    //下一页
    function xiayiye(){

        var pageNum = [[${list.pageNum}]]

        var info = [[${list.pages}]]
        //当前页等于总条数的时候就是最后一页！
        if(pageNum == info){
            alert("亲，已经是最后一页了！")
            return false;
        }
        var  name =  $("#studentname").val()
        //下一页
        var xiay =  [[${list.nextPage}]]
        location.href="/saisinglist?pageNum="+xiay+"&name="+name;
    }

    //尾页
    function wenye(){
        var  name =  $("#studentname").val()
        //  //尾页
        var wenye =  [[${list.pages}]]
        location.href="/saisinglist?pageNum="+wenye+"&name="+name;
    }


    //查看评价
    function pingjia(id){
        location.href="/rpingjia?id="+id;
    }



    //饲养
    function siyang(siyangshiId){
        location.href="/gmtaocan?rId="+siyangshiId;


    //    var begintime= $("#"+siyangshiId+'begin').val()
    //     var endtime= $("#"+siyangshiId+'end').val()
    //
    //
    //     if(begintime == ''|| begintime == null){
    //         alert("请选择开始时间！")
    //         return false
    //     }else if(endtime == '' || begintime == null){
    //         alert("请选择结束时间！")
    //         return false
    //     }
    //
    //     var date1=new Date(begintime);
    //     var date2=new Date(endtime);
    //
    //     if(date1 >= date2)
    //     {
    //         alert("结束日期不能小于或等于开始日期哦！");
    //         return false;
    //     }
    //
    //     var date=(date2.getTime()-date1.getTime())/(1000*60*60*24);
    //
    //     $.ajax({
    //         url:"/xvanzesiyang",
    //         type:"POST",
    //         data:{"siyangshiId":siyangshiId,"date":date},
    //         success:function (data) {
    //             alert(data)
    //         },
    //         error:function (){
    //             alert("服务内部故障，请联系技术人员！")
    //         }
    //     })
    //
    //
     }

</script>


</body>

</html>